﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace TextAnalyzer
{
    internal class KeyViewModel:INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        private string mKey = null;
        private string mHeader = null;
        private SearchType mType = 0;
        private bool mEntry = false;
        public string Key
        {
            get
            {
                return mKey;
            }
            set
            {
                mKey = value;
                RaisePropertyChanged("Key");
            }
        }
        public string Header
        {
            get
            {
                return mHeader;
            }
            set
            {
                mHeader = value;
                RaisePropertyChanged("Header");
            }
        }
        public SearchType Type
        {
            get
            {
                return mType;
            }
            set
            {
                mType = value;
                RaisePropertyChanged("Type");
            }
        }
        public bool Entry
        {
            get
            {
                return mEntry;
            }
            set
            {
                mEntry = value;
                RaisePropertyChanged("Entry");
            }
        }
        public KeyViewModel() { }
        public KeyViewModel(string strKey, string strHeader)
        {
            mKey = strKey;
            mHeader = strHeader;
            mType = SearchType.Label;
            mEntry = false;
        }
        public KeyViewModel(string strKey, string strHeader, SearchType enumType)
        {
            mKey = strKey;
            mHeader = strHeader;
            mType = enumType;
            mEntry = false;
        }
        public KeyViewModel(string strKey, string strHeader, SearchType enumType, bool bEntry)
        {
            mKey = strKey;
            mHeader = strHeader;
            mType = enumType;
            mEntry = bEntry;
        }
        private void RaisePropertyChanged(string strPropertyName)
        {
            PropertyChangedEventHandler _handler = this.PropertyChanged;
            if (null != _handler) _handler(this, new PropertyChangedEventArgs(strPropertyName));
        }
    }
}
